<!DOCTYPE html>





<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 3.9.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.4.0">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon32.ico?v=7.4.0">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon16.ico?v=7.4.0">
  <link rel="mask-icon" href="/images/logo.svg?v=7.4.0" color="#222">

<link rel="stylesheet" href="/css/main.css?v=7.4.0">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">
  <link rel="stylesheet" href="/lib/pace/pace-theme-loading-bar.min.css?v=1.0.2">
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    version: '7.4.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":true},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: 'search.xml',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    },
    sidebarPadding: 40
  };
</script>





  <script>
  (function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/0f81ff2f.js","daovoice")
  daovoice('init', {
      app_id: "8bb5ea98"
    });
  daovoice('update');
  </script>

  <meta name="description" content="线性回归之梯度下降/逻辑回归算法详解">
<meta name="keywords" content="机器学习,Python">
<meta property="og:type" content="article">
<meta property="og:title" content="线性回归之梯度下降&#x2F;逻辑回归算法">
<meta property="og:url" content="https://babyMonkey8.github.io/2019/10/08/20191008001/index.html">
<meta property="og:site_name" content="babyMonkey">
<meta property="og:description" content="线性回归之梯度下降/逻辑回归算法详解">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/1.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/2.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/4.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/3.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/5.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/6.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/7.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/8.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/9.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/10.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/11.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/12.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/13.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/14.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/15.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/16.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/17.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/18.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/19.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/20.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/21.png">
<meta property="og:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/22.png">
<meta property="og:updated_time" content="2019-10-13T06:44:05.097Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="线性回归之梯度下降&#x2F;逻辑回归算法">
<meta name="twitter:description" content="线性回归之梯度下降/逻辑回归算法详解">
<meta name="twitter:image" content="https://babymonkey8.github.io/2019/10/08/20191008001/1.png">
  <link rel="canonical" href="https://babyMonkey8.github.io/2019/10/08/20191008001/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>线性回归之梯度下降/逻辑回归算法 | babyMonkey</title>
  








  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">
  <div class="container use-motion">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">babyMonkey</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
      
      
      
        
        <li class="menu-item menu-item-home">
      
    

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-about">
      
    

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-tags">
      
    

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-categories">
      
    

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-archives">
      
    

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-schedule">
      
    

    <a href="/schedule/" rel="section"><i class="fa fa-fw fa-calendar"></i>日程表</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-sitemap">
      
    

    <a href="/sitemap.xml" rel="section"><i class="fa fa-fw fa-sitemap"></i>站点地图</a>

  </li>
      <li class="menu-item menu-item-search">
        <a href="javascript:;" class="popup-trigger">
        
          <i class="fa fa-search fa-fw"></i>搜索</a>
      </li>
    
  </ul>

    

</nav>
  <div class="site-search">
    <div class="popup search-popup">
    <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocorrect="off" autocapitalize="none"
           placeholder="搜索..." spellcheck="false"
           type="text" id="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result"></div>

</div>
<div class="search-pop-overlay"></div>

  </div>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

  <a href="https://github.com/yourname" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
      <article itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block post">
    <link itemprop="mainEntityOfPage" href="https://babyMonkey8.github.io/2019/10/08/20191008001/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="小小猿—铭">
      <meta itemprop="description" content="说IT">
      <meta itemprop="image" content="/images/cat.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="babyMonkey">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">线性回归之梯度下降/逻辑回归算法

          
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              
                
              

              <time title="创建时间：2019-10-08 15:23:10" itemprop="dateCreated datePublished" datetime="2019-10-08T15:23:10+08:00">2019-10-08</time>
            </span>
          
            

            
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2019-10-13 14:44:05" itemprop="dateModified" datetime="2019-10-13T14:44:05+08:00">2019-10-13</time>
              </span>
            
          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/机器学习/" itemprop="url" rel="index"><span itemprop="name">机器学习</span></a></span>

                
                
              
            </span>
          

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
          
          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="fa fa-file-word-o"></i>
              </span>
              
                <span class="post-meta-item-text">本文字数：</span>
              
              <span>1.7k</span>
            </span>
          
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="fa fa-clock-o"></i>
              </span>
              
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              
              <span>2 分钟</span>
            </span>
          
            <div class="post-description">线性回归之梯度下降/逻辑回归算法详解</div>
          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="线性回归"><a href="#线性回归" class="headerlink" title="线性回归"></a>线性回归</h1><h2 id="一个例子：如下图1"><a href="#一个例子：如下图1" class="headerlink" title="一个例子：如下图1"></a>一个例子：如下图1</h2><img src="/2019/10/08/20191008001/1.png" title="具体例子">

<p><strong>数据</strong>：工资和年龄（两个特征）  分别设为x<sub>1</sub>：工资       x<sub>2</sub>：年龄         x<sub>1</sub> ,x<sub>2</sub>连续型随机变量</p>
<p><strong>目标</strong>：预测银行会贷款给个人多少钱（标签） 设最终贷款的额度为  Y</p>
<p>则最终的函数可以写成：<strong>Y= θ<sub>0</sub> + θ<sub>1</sub>*x<sub>1</sub>  + θ<sub>2</sub>*x<sub>2</sub></strong>     我们可以用这个函数来拟合我们的数据点，如下图2</p>
<img src="/2019/10/08/20191008001/2.png" title="函数拟合">

<p>即拟合的平面：<strong>h<sub>θ</sub>(x) = θ<sub>0</sub> + θ<sub>1</sub> * x1 + θ<sub>2</sub> * x2</strong></p>
<pre><code>其中 θ1 是年龄的参数， θ2是工资的参数， θ1和 θ2称作**权重项**， θ0称作**偏置项**</code></pre><p>​     偏置项（作用：对整个H θ(x)的结果起到微调的作用）</p>
<p>为了更好地计算，我们令 x<sub>0</sub>= 0，由此可以得出<strong>h<sub>θ</sub>(x) = θ<sub>0</sub>*x<sub>0</sub> + θ<sub>1</sub>*x<sub>1</sub>  + θ<sub>2</sub>*x<sub>2</sub></strong> </p>
<p>整合之后：<strong>h<sub>θ</sub>(x) =  ∑θ<sub>i</sub>*x<sub>i</sub></strong>    (整合之后转化为矩阵，更好计算)</p>
<h2 id="误差项"><a href="#误差项" class="headerlink" title="误差项"></a>误差项</h2><p>由上可以得出每个样本：真实值和预测值之间存在一定的误差：<strong>y<sup>(i)</sup> = θ<sup>T</sup> * x<sup>(i)</sup> + ε<sup>(i)</sup></strong></p>
<p>​    即      y<sup>(i)</sup> 为真实值                       θ<sup>T</sup> * x<sup>(i)</sup> 为预测值                       <strong>ε<sup>(i)</sup> 为误差项</strong></p>
<p><strong>误差项ε<sup>(i)</sup> 详解：</strong></p>
<p>​    误差ε<sup>(i)</sup> ：<strong>是独立并且具有相同的分布，并且服从均值为0方差为 θ<sup>2</sup> 的高斯分布</strong></p>
<p>​        <strong>独立：</strong>例如：张三和李四一起来贷款，他们两个能获得多少额度的贷款没有与他们两个没有关系</p>
<p>​            独立要求数据中每个样本间互不影响——在实际项目中体现为必须<strong>对数据进行洗牌</strong></p>
<p>​        <strong>同分布：</strong>例如：张三和李四都必须在指定的同一家银行贷款</p>
<p>​        <strong>高斯分布：</strong>例如：银行可能会多给，也可能会少给，但是绝大部分情况下这个浮动不会太大，极少数情况下        浮动会比较大，符合正常情况</p>
<p>​        【补充】高斯分布</p>
<p>​            高斯分布形态：中间多，两边少，大多数情况下位于中间段</p>
<p>​            高斯分布公式：</p>
<img src="/2019/10/08/20191008001/4.png" title="高斯分布2">

<img src="/2019/10/08/20191008001/3.png" title="高斯分布1">

<p>由于误差项服从均值为0，方差为 θ<sup>2</sup> 的高斯分布    </p>
<img src="/2019/10/08/20191008001/5.png" title="高斯分布5">

<p>​    如上图：x<sup>(i)</sup>与 θ组合之后，为了得到更好的预测值，我们希望预测值与真实值y<sup>(i)</sup>越接近越好，即：x<sup>(i)</sup>与 θ组合    后成为y<sup>(i)</sup>的可能性越大越好</p>
<h2 id="似然函数-对数函数"><a href="#似然函数-对数函数" class="headerlink" title="似然函数/对数函数"></a>似然函数/对数函数</h2><img src="/2019/10/08/20191008001/6.png" title="高斯分布6">

<h3 id="似然函数"><a href="#似然函数" class="headerlink" title="似然函数"></a>似然函数</h3><p>​    【补充】似然函数</p>
<img src="/2019/10/08/20191008001/7.png" title="高斯分布7">

<img src="/2019/10/08/20191008001/8.png" title="高斯分布8">

<p>​        Π （累乘符号）：独立同分布的前提：联合概率密度=边缘概率密度的乘积</p>
<p>​                举例：在赌局中，第一个人赌赢，第二个人也赌赢…….,第一百个人也赌赢，那么我们预测第一百零一个                            人也将会赌赢</p>
<h3 id="对数函数"><a href="#对数函数" class="headerlink" title="对数函数"></a>对数函数</h3><p>​    我们并不关心L(θ),而是希望求出极值点θ，因此，我们给似然函数加上log处理，并不影响所求</p>
<h3 id="化简，求值"><a href="#化简，求值" class="headerlink" title="化简，求值"></a>化简，求值</h3><img src="/2019/10/08/20191008001/9.png" title="高斯分布9">

<p>​    得到的 J(θ）为目标函数，又称损失函数，得到的 J(θ）越小越好</p>
<img src="/2019/10/08/20191008001/10.png" title="高斯分布10">

<p>​    【补充】求最值点的方法</p>
<img src="/2019/10/08/20191008001/11.png" title="高斯分布11">

<p>​    使用这种<strong>直接求解</strong>的方式：在偏导等于0时，得出的θ，存在两个问题：</p>
<p>​    （1）直接求解，不存在学习的过程</p>
<p>​    （2）(X<sup>T</sup> X)<sup>-1</sup>: 这种矩阵的逆求解不一定有解，所以不一定能求出θ值</p>
<h2 id="梯度下降"><a href="#梯度下降" class="headerlink" title="梯度下降"></a>梯度下降</h2><img src="/2019/10/08/20191008001/12.png" title="高斯分布12">

<h3 id="目标函数解释"><a href="#目标函数解释" class="headerlink" title="目标函数解释"></a>目标函数解释</h3><p>​    （1）对目标函数求偏导：在优化的过程中，是分别对每个θ进行优化的</p>
<p>​                原因：每一个X,都是独立的，因此每个θ之间也没有任何相互影响的关系</p>
<p>​    （2）对目标函数求平方：是放大结果，是目标函数的损失更加敏感</p>
<p>​    （3）m：即求出m个样本损失的平均值</p>
<p>​    （4）对目标函数求偏导，相当于对复合函数求偏导</p>
<img src="/2019/10/08/20191008001/13.png" title="高斯分布13">

<p>​    【补充】</p>
<p>​            下山越快越好：沿着切线</p>
<p>​            梯度：本来的方向是向上，所以增加负好，变成梯度下降</p>
<img src="/2019/10/08/20191008001/14.png" title="高斯分布14">

<img src="/2019/10/08/20191008001/15.png" title="高斯分布15">

<img src="/2019/10/08/20191008001/16.png" title="高斯分布16">







<h1 id="逻辑回归算法"><a href="#逻辑回归算法" class="headerlink" title="逻辑回归算法"></a>逻辑回归算法</h1><img src="/2019/10/08/20191008001/17.png" title="内容17">

<img src="/2019/10/08/20191008001/18.png" title="内容18">

<img src="/2019/10/08/20191008001/19.png" title="内容19">

<img src="/2019/10/08/20191008001/20.png" title="内容20">

<p>​    【补充】</p>
<p>​        预测值：y<sup>(i)</sup> = θ<sup>T</sup> * x<sup>(i)</sup> </p>
<img src="/2019/10/08/20191008001/21.png" title="内容21">

<img src="/2019/10/08/20191008001/22.png" title="内容22">
































    </div>

    
    
    
        
      
        <div id="reward-container">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="reward-button" disable="enable" onclick="var qr = document.getElementById(&quot;qr&quot;); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">
        
      
      <div style="display: inline-block">
        <img src="/images/wechatpay.png" alt="小小猿—铭 微信支付">
        <p>微信支付</p>
      </div>
        
      
      <div style="display: inline-block">
        <img src="/images/alipay.jpg" alt="小小猿—铭 支付宝">
        <p>支付宝</p>
      </div>

  </div>
</div>

      
      <footer class="post-footer">
          
            
          
          <div class="post-tags">
            
              <a href="/tags/机器学习/" rel="tag"># 机器学习</a>
            
              <a href="/tags/Python/" rel="tag"># Python</a>
            
          </div>
        

        

          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
              
                <a href="/2019/10/01/20191012006/" rel="next" title="人工智能数学基础之高中数学：数列与不等式">
                  <i class="fa fa-chevron-left"></i> 人工智能数学基础之高中数学：数列与不等式
                </a>
              
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
              
                <a href="/2019/10/10/20191010002/" rel="prev" title="人工智能数学基础之高中数学：集合与函数">
                  人工智能数学基础之高中数学：集合与函数 <i class="fa fa-chevron-right"></i>
                </a>
              
            </div>
          </div>
        

      </footer>
    
  </div>
  
  
  
  </article>

  </div>


          </div>
          

        </div>
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">
        
        
        
        
      

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#线性回归"><span class="nav-number">1.</span> <span class="nav-text">线性回归</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#一个例子：如下图1"><span class="nav-number">1.1.</span> <span class="nav-text">一个例子：如下图1</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#误差项"><span class="nav-number">1.2.</span> <span class="nav-text">误差项</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#似然函数-对数函数"><span class="nav-number">1.3.</span> <span class="nav-text">似然函数/对数函数</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#似然函数"><span class="nav-number">1.3.1.</span> <span class="nav-text">似然函数</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#对数函数"><span class="nav-number">1.3.2.</span> <span class="nav-text">对数函数</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#化简，求值"><span class="nav-number">1.3.3.</span> <span class="nav-text">化简，求值</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#梯度下降"><span class="nav-number">1.4.</span> <span class="nav-text">梯度下降</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#目标函数解释"><span class="nav-number">1.4.1.</span> <span class="nav-text">目标函数解释</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#逻辑回归算法"><span class="nav-number">2.</span> <span class="nav-text">逻辑回归算法</span></a></li></ol></div>
        
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image"
      src="/images/cat.jpg"
      alt="小小猿—铭">
  <p class="site-author-name" itemprop="name">小小猿—铭</p>
  <div class="site-description" itemprop="description">说IT</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        
          <a href="/archives/">
        
          <span class="site-state-item-count">9</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-categories">
        
        <span class="site-state-item-count">3</span>
        <span class="site-state-item-name">分类</span>
        
      </div>
    
      
      
      <div class="site-state-item site-state-tags">
        
        <span class="site-state-item-count">5</span>
        <span class="site-state-item-name">标签</span>
        
      </div>
    
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="https://github.com/yourname" title="GitHub &rarr; https://github.com/yourname" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="https://plus.google.com/yourname" title="Google &rarr; https://plus.google.com/yourname" rel="noopener" target="_blank"><i class="fa fa-fw fa-google"></i>Google</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="https://baidu.com" title="百度 &rarr; https://baidu.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-firefox"></i>百度</a>
      </span>
    
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title">
      <i class="fa fa-fw fa-link"></i>
      友情链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="https://www.lixint.me/" title="https://www.lixint.me/" rel="noopener" target="_blank">LixT</a>
        </li>
      
        <li class="links-of-blogroll-item">
          <a href="https://www.codesheep.cn/" title="https://www.codesheep.cn/" rel="noopener" target="_blank">程序羊</a>
        </li>
      
    </ul>
  </div>

      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">小小猿—铭</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    <span title="站点总字数">5k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">4 分钟</span>
</div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
  
    <span class="post-meta-divider">|</span>
  
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
  
</div>












        
      </div>
    </footer>
  </div>

  
    
    
  
    
  
  <script color='0,0,255' opacity='0.5' zIndex='-1' count='250' src="/lib/canvas-nest/canvas-nest.min.js"></script>
  <script src="/lib/anime.min.js?v=3.1.0"></script>
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  <script defer src="/lib/three/three.min.js"></script>
  <script defer src="/lib/three/canvas_lines.min.js"></script>
<script src="/js/utils.js?v=7.4.0"></script><script src="/js/motion.js?v=7.4.0"></script>
<script src="/js/schemes/muse.js?v=7.4.0"></script>
<script src="/js/next-boot.js?v=7.4.0"></script>



  








  <script src="/js/local-search.js?v=7.4.0"></script>














  

  

  




<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
